package com.atguigu.spzx.controller;


import com.atguigu.spzx.model.dto.system.AssginMenuDto;
import com.atguigu.spzx.model.vo.common.Result;
import com.atguigu.spzx.model.vo.common.ResultCodeEnum;
import com.atguigu.spzx.service.SysRoleMenuService;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;


@RestController
@RequestMapping("/admin/system/sysRoleMenu")
public class SysRoleMenuController {


    @Autowired
    private SysRoleMenuService sysRoleMenuService;

    @GetMapping("/findSysRoleMenuByRoleId/{id}")
    public Result<Map<String, Object>> findSysRoleMenuByRoleId(@PathVariable(value = "id") Long id) {
        Map<String, Object> map = sysRoleMenuService.findSysRoleMenuByRoleId(id);

        return Result.build(map, ResultCodeEnum.SUCCESS);

    }


    @PostMapping("/doAssign")
    public Result doAssign(@RequestBody AssginMenuDto assginMenuDto){
            sysRoleMenuService.doAssign(assginMenuDto);
            return Result.build(null, ResultCodeEnum.SUCCESS);
    }


}
